/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package csse3004.GD.WBUser;

import csse3004.GD.MCAnswer;
import csse3004.GD.MCQuestion;
import csse3004.GD.Message;
import csse3004.GD.PM.PollMasterService;
import csse3004.GD.Poll;
import csse3004.GD.Question;
import csse3004.GD.SRAnswer;
import csse3004.GD.SRQuestion;
import java.util.ArrayList;

/**
 *
 * @author Tom McNair - S41758984
 */
public interface WBUserService {
    
    /**
     * variable holds if the user should use dummy data or not, ie if they are 
     * connected to the database
     */
    public boolean database = PollMasterService.database;
    
    public int getNextID(String Table);
    
    public ArrayList<Poll> getPolls(int userID);
    public Poll getPoll(int pollID);
    
    public ArrayList<Question> getQuestions(int pollID);
    
    public MCQuestion getMCQuestion(int questionID);
    public SRQuestion getSRQuestion(int questionID);
    
    public ArrayList<MCAnswer> getMCAnswers(int questionID);
    public ArrayList<SRAnswer> getSRKeywords(int questionID);
    
    public boolean answerMC(int answerID, int preference, int questionID, int userID);
    public boolean answerSR(String response, int questionID, int userID);
    
    /**
     * Function that gets all messages for a Web User
     * 
     * @param userID
     * @return 
     */
    public ArrayList<Message> getMessages(int userID);
    
    /**
     * Function that sets a message to be Read/Unread
     * 
     * @param userID The ID of the Message
     * @param read True to set the Message to read, False to set Unread
     * @return 
     */
    public boolean setMessageRead(int userID, boolean read);
    
    /**
     * Function that retrieves the ID of the next question in the poll
     * 
     * @param pollID ID of the Poll
     * @param currentQuestion ID of the current question
     * @return 
     */
    int getNextQuestion(int pollID, boolean isNext, int currentQuestion) ;
    
    /**
     * Function to retrieve a question by id.
     * 
     * @param questionID ID of the question
     * @return either a MCQuestion or a SRQuestion
     */
    Question getQuestion(int questionID);
    
    /**
     * Function to add feedback for a question
     * 
     * @param feedback String containing the feedback
     * @param questionID ID of the question
     * @return True if successful, otherwise false
     */
    boolean sendFeedback(String feedback, int questionID);
    
    /**
     * Sets the users password, no validation beyond that the user exists is 
     * required
     * @param userID
     * @param password The password to be set
     * @return false only if the user doesn't exist
     */
    public boolean setPassword(int userID, String password);
    
    public int setNext(boolean isNext, int pid);
    public int getActiveQuestionID(int pollID);
    
    public ArrayList<PollUsers> getActiveUsers(int pollID); 
}
